use hidapi::DeviceInfo;

extern crate hidapi;

fn main() {
    let api = hidapi::HidApi::new().unwrap();
    let mut list:Vec<&DeviceInfo> = api.device_list().collect();

    list.sort_by(|d1,d2|{ d1.vendor_id().cmp(&d2.vendor_id()) });

    for device in list {
        println!(
            "{{{:04X},{:04X},{:#?},{:#?},{:#?}}}",
            device.vendor_id(),
            device.product_id(), 
            device.product_string().expect(""),
            device.manufacturer_string().expect(""),
            device.path()
        );
    }
}
